package com.ruoyi.spectrum.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SNUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.spectrum.mapper.EnvSpectrumMapper;
import com.ruoyi.spectrum.domain.EnvSpectrum;
import com.ruoyi.spectrum.service.IEnvSpectrumService;

/**
 * 环境光谱Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-02
 */
@Service
public class EnvSpectrumServiceImpl implements IEnvSpectrumService 
{
    @Autowired
    private SNUtil snUtil;
    @Autowired
    private EnvSpectrumMapper envSpectrumMapper;

    /**
     * 查询环境光谱
     * 
     * @param envSpectrumId 环境光谱主键
     * @return 环境光谱
     */
    @Override
    public EnvSpectrum selectEnvSpectrumByEnvSpectrumId(Long envSpectrumId)
    {
        return envSpectrumMapper.selectEnvSpectrumByEnvSpectrumId(envSpectrumId);
    }

    /**
     * 查询环境光谱列表
     * 
     * @param envSpectrum 环境光谱
     * @return 环境光谱
     */
    @Override
    public List<EnvSpectrum> selectEnvSpectrumList(EnvSpectrum envSpectrum)
    {
        return envSpectrumMapper.selectEnvSpectrumList(envSpectrum);
    }

    /**
     * 新增环境光谱
     * 
     * @param envSpectrum 环境光谱
     * @return 结果
     */
    @Override
    public int insertEnvSpectrum(EnvSpectrum envSpectrum)
    {
        String env_spectrum_no = snUtil.generateSN("env_spectrum", "env_spectrum_no", "yyyyMMdd", "ES", 4);
        envSpectrum.setEnvSpectrumNo(env_spectrum_no);
        envSpectrum.setCreateTime(DateUtils.getNowDate());
        return envSpectrumMapper.insertEnvSpectrum(envSpectrum);
    }

    /**
     * 修改环境光谱
     * 
     * @param envSpectrum 环境光谱
     * @return 结果
     */
    @Override
    public int updateEnvSpectrum(EnvSpectrum envSpectrum)
    {
        return envSpectrumMapper.updateEnvSpectrum(envSpectrum);
    }

    /**
     * 批量删除环境光谱
     * 
     * @param envSpectrumIds 需要删除的环境光谱主键
     * @return 结果
     */
    @Override
    public int deleteEnvSpectrumByEnvSpectrumIds(Long[] envSpectrumIds)
    {
        return envSpectrumMapper.deleteEnvSpectrumByEnvSpectrumIds(envSpectrumIds);
    }

    /**
     * 删除环境光谱信息
     * 
     * @param envSpectrumId 环境光谱主键
     * @return 结果
     */
    @Override
    public int deleteEnvSpectrumByEnvSpectrumId(Long envSpectrumId)
    {
        return envSpectrumMapper.deleteEnvSpectrumByEnvSpectrumId(envSpectrumId);
    }
}
